home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c++-part2 / 13100 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  828 b 

  1. Path: coranto.ucs.mun.ca!usenet
  2. From: saustin@terra.nlnet.nf.ca (Steve Austin)
  3. Newsgroups: comp.lang.c++
  4. Subject: Re: mixing static and const qualifiers for class members
  5. Date: Sat, 23 Mar 1996 14:49:59 GMT
  6. Organization: Kickham Productions
  7. Message-ID: <4j1327$235@coranto.ucs.mun.ca>
  8. References: <1996Mar20.143749.90333@ucl.ac.uk>
  9. NNTP-Posting-Host: n104h131.nlnet.nf.ca
  10. X-Newsreader: Forte Agent .99b.112
  11.  
  12. ucecb09@ucl.ac.uk (Robert Byrne) wrote:
  13.  
  14. >The simple way to declare integral class constants is with an enumeration.
  15. >
  16. >class Foo{
  17. >    enum constants{nPositions = 6};
  18. >    public:
  19. >    int nData[nPositions];
  20. >};
  21.  
  22. I know some compilers ( eg Borland ) allow this, but is this portable?
  23. I've always cast to int in this situation:
  24.  
  25.     nt nData[int(nPositions)];
  26.  
  27. Mind you, I've never checked on this. Am I wasting my time?
  28.  
  29.  - Steve
  30.  
  31.